package com.wuyou.designPatterns.chainofresponsibility;

/**
 * 解决有限问题
 *
 * @Date 2024/10/12 15:20
 * @Author 无忧
 */
public class LimitSupport extends Support{

    private int limit;

    public LimitSupport(String name, int limit) {
        super(name);
        this.limit = limit;
    }

    /**
     * 解决问题的方法
     * @param trouble
     * @return
     */
    @Override
    protected boolean resolve(Trouble trouble) {
        if(trouble.getNumber() < limit){
            return true;
        }
        return false;
    }
}
